﻿using Simple.Common.Helpers;
using System;
using System.ComponentModel.DataAnnotations.Schema;

namespace Simple.Services.System.QHSEUser.Models;

/// <summary>
/// 学生
/// </summary>
public class QHSEUserModel : ModelBase
{
    public string? IdCard { get; set; } = "";


    public DateTime UpdateTime { get; set; }


    public DateTime CreateTime { get; set; }

    public int? UserSex { get; set; } = 0;


    public QHSEUserStatusType UserStatus { get; set; } = QHSEUserStatusType.Enable;

    public QHSEUserFromType UserFrom { get; set; } = QHSEUserFromType.Unknown;

    [MaxLength(10)]
    public string? EmployeeNo { get; set; } = "";

    [MaxLength(16)]
    public string? Mobile { get; set; } = "";

    [MaxLength(32)]
    [Key]
    public string UserId { get; set; } = "";

    [MaxLength(32)]
    public string? UserName { get; set; } = "";

    [MaxLength(32)]
    public string? Email { get; set; } = "";

    [MaxLength(34)]
    public string? OrganizationId { get; set; } = "";
    [MaxLength(64)]
    public string? OrganizationName { get; set; } = "";

    [MaxLength(512)]
    public string? UserAvatar { get; set; } = "";

    public override void ConfigureMapper(Profile profile)
    {
        profile.CreateMap<QHSESysUser, QHSEUserModel>()
            .ForMember(d => d.UserId, options => options.MapFrom(s => s.UserId));

        profile.CreateMap<QHSEUserModel, QHSESysUser>()
            .ForMember(d => d.UserId, options => options.MapFrom(s => s.UserId));
    }
}

